﻿namespace Dissemination.MVC.Repositories
{
    using System.Linq;
    using System.Collections.Generic;
    using Dissemination.MVC.Models;

    public class AssessmentRepository : BaseRepository<Assessment>
    {
        public AssessmentRepository()
        {
            EntityName = "Assessments";
        }

        public override List<Assessment> List()
        {
            return dataContext.Assessments.ToList();
        }

        public List<Assessment> ListBySeminarID(int seminarID)
        {
            return dataContext.Assessments.Where(a => a.Seminar.SeminarID == seminarID).ToList();
        }

        public Seminar GetSeminarByID(int seminarID)
        {
            return dataContext.Seminars.Include("TargetArea.Country").Include("TargetArea.Program").Include("Participants").Include("Assessments").FirstOrDefault(s => s.SeminarID == seminarID);
        }

        public override Assessment Get(int id)
        {
            return dataContext.Assessments.Include("Seminar.TargetArea.Country").FirstOrDefault(a => a.AssessmentID == id);
        }
    }
}
